<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>dc-example</title>
  <script src='/libs/dc-sdk/dc.base.min.js'></script>
  <script src='/libs/dc-sdk/dc.core.min.js'></script>
  <script>DC.baseUrl='../libs/dc-sdk/resources/'</script>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.9/dat.gui.min.js'></script>
  <link href='/libs/dc-sdk/dc.core.min.css' type='text/css' rel='stylesheet'>
  <link href='../index.css' type='text/css' rel='stylesheet'>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    html,body,#viewer-container{
      width: 100%;
      height: 100%;
      overflow: hidden;
    }
  </style>

<body>

<div id="viewer-container" class="viewer-container"></div>

<script>
       DC.config.baseUrl = '../libs/dc-sdk/resources/'
      let viewer = new DC.Viewer('viewer-container')
    let  baseLayer = DC.ImageryLayerFactory.createBaiduImageryLayer({
      style: 'midnight'
    })
    viewer.addBaseLayer( baseLayer)
    addGuiController() // add controller
  }

  function addGuiController(){
    let controls = {
      alpha :1,
      brightness : 1,
      contrast:1,
      saturation:1
    }
    let imageryLayer = viewer.imageryLayers.get(0)
    let gui = new dat.GUI();
    gui.add(controls,'alpha',0,1).step(0.1).onChange(value=>{
      imageryLayer.alpha = value
    })
    gui.add(controls,'brightness',-1,5).step(0.1).onChange(value=>{
      imageryLayer.brightness = value
    })
    gui.add(controls,'contrast',-1,3).step(0.1).onChange(value=>{
      imageryLayer.contrast = value
    })
    gui.add(controls,'saturation',0,2).step(0.1).onChange(value=>{
      imageryLayer.saturation = value
    })
  }


</script>

</body>
</html>
